#ifndef RECTANGLE_H
#define RECTANGLE_H

#include <iostream>
#include <functional>


class Rectangle
{
	public:
		Rectangle(int id, double height, double width);
		Rectangle(int id);

		~Rectangle();
		double area() const;
		double top() const;
		double bottom() const;
		double left() const;
		double right() const;
		int name() const;

		void place(double x,double y);
		void size(double h, double w);
		void rotate();

		struct  SameId: public std::binary_function<Rectangle, Rectangle, bool>
		{
			bool operator()(const Rectangle& x, const Rectangle& y) const { return x.id == y.id; }
		};

		struct  LessHeight: public std::binary_function<Rectangle, Rectangle, bool>
		{
			bool operator()(const Rectangle& x, const Rectangle& y) const { return x.height  < y.height; }
		};

		struct  WidthLessThan: public std::binary_function<Rectangle, double, bool>
		{
			bool operator()(const Rectangle& x, double w) const { return x.width  < w; }
		};

		struct  WidthMoreThan: public std::binary_function<Rectangle, double, bool>
		{
			bool operator()(const Rectangle& x, double w) const { return x.width  > w; }
		};

	protected:
		int id;
		double height;
		double width;
		double x,y;

	private:
};

std::ostream& operator << (std::ostream& out, const Rectangle& r);
std::istream& operator >> (std::istream& in, Rectangle& r);


#endif // RECTANGLE_H
